package com.ynny.Controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.ynny.Monitor.MonitorBlockHandler;
import com.ynny.fallback.SentinelFallback;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/sentinel")
public class SentinelController {
    @GetMapping("/rt")
    @SentinelResource(value = "getRTResource",fallback = "rtFallback",fallbackClass = SentinelFallback.class)
    public String getRT() {
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        return "进入 RT";
    }
}
